From 2f39c3b3180419feb2975ba59f7d468b3433331f Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sat, 29 Aug 2015 13:26:06 -0400 Subject: [PATCH] Make verify-project able to verify the current working dir project All other commands use the Cargo.toml in the current directory if --manifest-path is not specified; this makes verify-project consistent. --- src/bin/verify_project.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index b8d3f657c..86aa305a6 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -11,7 +11,7 @@ pub type Error = HashMap; #[derive(RustcDecodable)] struct Flags { - flag_manifest_path: String, + flag_manifest_path: Option, flag_verbose: bool, flag_quiet: bool, flag_color: Option, @@ -19,7 +19,7 @@ struct Flags { pub const USAGE: &'static str = " Usage: - cargo verify-project [options] --manifest-path PATH + cargo verify-project [options] cargo verify-project -h | --help Options: @@ -35,7 +35,8 @@ pub fn execute(args: Flags, config: &Config) -> CliResult> { try!(config.shell().set_color_config(args.flag_color.as_ref().map(|s| &s[..]))); let mut contents = String::new(); - let file = File::open(&args.flag_manifest_path); + let filename = args.flag_manifest_path.unwrap_or("Cargo.toml".into()); + let file = File::open(&filename); match file.and_then(|mut f| f.read_to_string(&mut contents)) { Ok(_) => {}, Err(e) => fail("invalid", &format!("error reading file: {}", e)) -- 2.30.2